<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel="stylesheet" type="text/css" href="css/ol.css"/>
    <script src="../js/ol.js"></script>
<!--    <script src="./flash-marker.js"></script>-->
    <script src="./flash-marker-pri.js"></script>
</head>
<body>
<div id="map"></div>
<button id="clear"  type="button" onclick="clear1()">清除按钮</button>
</body>

<script type="text/javascript">
    var projection = ol.proj.get('EPSG:4326');
    var projectionExtent = projection.getExtent();
    var size = ol.extent.getWidth(projectionExtent) / 256;
    var resolutions = new Array(19);
    var matrixIds = new Array(19);
    for (var z = 1; z < 19; ++z) {
        resolutions[z] = size / Math.pow(2, z);
        matrixIds[z] = z;
    }

    var map = new ol.Map({
        target: 'map',
        layers: [
            new ol.layer.Tile({
                source: new ol.source.WMTS({
                    name: "天地图影像地图",
                    url: "http://t{0-7}.tianditu.gov.cn/img_c/wmts?tk=38714c443b01bbf3f85d0c036e7c6411",
                    layer: "img",
                    style: "default",
                    matrixSet: "c",
                    format: "tiles",
                    wrapX: true,
                    tileGrid: new ol.tilegrid.WMTS({
                        origin: ol.extent.getTopLeft(projectionExtent),
                        resolutions: resolutions,
                        matrixIds: matrixIds
                    })
                }),
                maxResolution: resolutions[0],
                minResolution: resolutions[18]
            })
        ],
        view: new ol.View({
            projection: 'EPSG:4326',
            center: [113.53450137499999, 34.44104525],
            zoom: 5
        })
    });



    //数据
    let lnglat=[113.53450137499999, 34.44104525];//坐标值[x,y]
    let citys = [{
        name: '测试1',
        lnglat: [113.53450137499999, 34.44104525],
        color: '#5070FF',
        type: 'circle',
        speed: 0.5,
    },
        {
            name: '测试2',
            lnglat: [114.53450137499999, 33.44104525],
            color: '#5070FF',
            type: 'circle',
            speed: 0.5,
        }];


    var flashMarker = new window.FlashMarker(map, citys);
    if (flashMarker) {
        flashMarker.close();
    }
    function clear1(){
        debugger
        if (flashMarker){
            flashMarker.removeAllFlashMarker();
        }
    }

</script>
</html>

